package com.smart.platform.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.smart.platform.common.Result;
import com.smart.platform.entity.Score;
import com.smart.platform.service.ScoreService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Slf4j
//@RestController
@Api(tags = "学生数据接口")
//这个注释是将下面Controller的请求路径统一为/employee，就是相当于在这里统一设置了
@RequestMapping("/Score")
public class ScoreController {
    @Autowired
    private ScoreService scoreService;

    public Result<List<Score>> get(){
        LambdaQueryWrapper<Score> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.select(Score::getTotal)
                .groupBy(Score::getClasses);

        return Result.success(scoreService.list(queryWrapper));
    }
}
